<?php
require_once("vcl/vcl.inc.php");
require_once("lib/db_connection.php");
//Includes
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");

//Class definition
class Unit1 extends Page
{
       public $memoComments = null;
       public $cmbAccount = null;
       public $cmbReason = null;
       public $edReference = null;
       public $hiddenStockId = null;
       public $hiddenStockNum = null;
       public $Image1 = null;
       public $btnCancel = null;
       public $btnSubmit = null;
       public $Label4 = null;
       public $Label3 = null;
       public $Label8 = null;
       public $Label1 = null;
       public $edQtyAvail = null;
       public $Label2 = null;
       function btnCancelClick($sender, $params)
       {
       redirect('inventory_status.php?stock_id='.$this->hiddenStockId->getValue());


       }

       function Unit1Create($sender, $params)
       {
       $stock_id = $_GET[$stock_id];
       $stock_num = $_GET[$stock_num];
       $this->hiddenStockId->setValue($stock_id);
       $this->hiddenStockNum->setValue($stock_num);

       }

       function btnSubmitClick($sender, $params)
       {
        mysql_query("INSERT INTO invstocks_invjournal_tbl(company_id,
       stock_id,
       quantity,
       references,
       reason,
       account,
       comments)

       VALUES
       ('".$_SESSION['company_id']."',
       '".$this->hiddenStockId->getValue()."',
       '".$this->edQtyAvail->Text."',
       '".$this->edReference->Text."',
       '".$this->cmbReason->getItemIndex()."',
       '".$this->cmbAccount->getItemIndex()."',
       '".$this->memoComments->Text."')") or die("INSERT ADJUSTMENT - ".mysql_error());

       redirect('inventory_status.php?stock_id='.$this->hiddenStockId->getValue());


       }

}

global $application;

global $Unit1;

//Creates the form
$Unit1=new Unit1($application);

//Read from resource file
$Unit1->loadResource(__FILE__);

//Shows the form
$Unit1->show();

?>